/*
 * Copyright 2018 JDCLOUD.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * JCLOUD DETECTION SUBSCRIBE API
 * detection API
 *
 * OpenAPI spec version: v2
 * Contact: 
 *
 * NOTE: This class is auto generated by the jdcloud code generator program.
 */


using JDCloudSDK.Core.Auth;
using JDCloudSDK.Core.Client;
using JDCloudSDK.Core.Http;
using JDCloudSDK.Detection.Apis;
using JDCloudSDK.Detection.Model;
using System;
using System.Collections.Generic;
using System.Text;
#if NET40||NET35
#else
using System.Threading.Tasks;
#endif

namespace JDCloudSDK.Detection.Client
{
    /// <summary>
    ///  JCLOUD DETECTION SUBSCRIBE API
    ///  detection API
    ///  Detection Api 客户端
    ///</summary>
    public class DetectionClient : JdcloudClient
    {

        /// <summary>
        ///  默认私有构造函数
        /// </summary>
        private DetectionClient()
        {

        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="environment">sdk 环境配置信息</param>
        public DetectionClient(CredentialsProvider credentialsProvider, HttpRequestConfig httpRequestConfig,SDKEnvironment environment)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
            this.environment = environment;
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="credentialsProvider">认证信息</param>
        public DetectionClient(CredentialsProvider credentialsProvider,HttpRequestConfig httpRequestConfig)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        /// 默认构造函数，
        /// 注意如果使用此方法 httpRequestConfig 使用的http 请求 schema 为Https
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        public DetectionClient(CredentialsProvider credentialsProvider)
        {
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        ///  版本号 1.2.0
        ///</summary>
        public const string ClientVersion = "1.2.0";

        private const string apiVersion = "v2";
        private const string userAgentPrefix = "JdcloudSdkDotNet";
        private const string defaultEndpoint = "detection.jdcloud-api.com";
        private const string serviceName = "detection";
        private const string userAgent = userAgentPrefix + "/" + ClientVersion + " " + serviceName + "/" + apiVersion;


        private SDKEnvironment environment = new SDKEnvironment(defaultEndpoint);
        private CredentialsProvider credentialsProvider;
        private HttpRequestConfig httpRequestConfig;

        /// <summary>
        ///  获取证书信息
        ///</summary>
        public override CredentialsProvider CredentialsProvider   { get { return credentialsProvider; } }

        /// <summary>
        ///  获取http 客户端配置信息
        ///</summary>
        public override HttpRequestConfig HttpRequestConfig { get { return httpRequestConfig; } }

        /// <summary>
        ///  获取sdk环境配置信息
        ///</summary>
        public override SDKEnvironment SDKEnvironment { get { return environment; } }

        /// <summary>
        ///  获取用户自定义浏览器识别字符串
        ///</summary>
        public override string UserAgent { get { return userAgent; } }

        /// <summary>
        ///  获取服务名称
        ///</summary>
        public override string ServiceName { get { return serviceName; } }

        /// <summary>
        ///  获取版本号
        ///</summary>
        public override string Version { get { return apiVersion; } }



#if NET40||NET35
        /// <summary>
        ///  检测站点监控地址是否有效
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ValidateSiteMonitorAddressResponse ValidateSiteMonitorAddress(ValidateSiteMonitorAddressRequest request) {
            return  new ValidateSiteMonitorAddressExecutor().Client(this).Execute<ValidateSiteMonitorAddressResponse, ValidateSiteMonitorAddressResult, ValidateSiteMonitorAddressRequest>(request);
        }
#else
        /// <summary>
        ///  检测站点监控地址是否有效
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ValidateSiteMonitorAddressResponse> ValidateSiteMonitorAddress(ValidateSiteMonitorAddressRequest request) {
            return await new ValidateSiteMonitorAddressExecutor().Client(this).Execute<ValidateSiteMonitorAddressResponse, ValidateSiteMonitorAddressResult, ValidateSiteMonitorAddressRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateProbeTaskResponse CreateProbeTask(CreateProbeTaskRequest request) {
            return  new CreateProbeTaskExecutor().Client(this).Execute<CreateProbeTaskResponse, CreateProbeTaskResult, CreateProbeTaskRequest>(request);
        }
#else
        /// <summary>
        ///  创建可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateProbeTaskResponse> CreateProbeTask(CreateProbeTaskRequest request) {
            return await new CreateProbeTaskExecutor().Client(this).Execute<CreateProbeTaskResponse, CreateProbeTaskResult, CreateProbeTaskRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  测试站点监控参数
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public TestSiteMonitorResponse TestSiteMonitor(TestSiteMonitorRequest request) {
            return  new TestSiteMonitorExecutor().Client(this).Execute<TestSiteMonitorResponse, TestSiteMonitorResult, TestSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  测试站点监控参数
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<TestSiteMonitorResponse> TestSiteMonitor(TestSiteMonitorRequest request) {
            return await new TestSiteMonitorExecutor().Client(this).Execute<TestSiteMonitorResponse, TestSiteMonitorResult, TestSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启停站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EnableSiteMonitorResponse EnableSiteMonitor(EnableSiteMonitorRequest request) {
            return  new EnableSiteMonitorExecutor().Client(this).Execute<EnableSiteMonitorResponse, EnableSiteMonitorResult, EnableSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  启停站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EnableSiteMonitorResponse> EnableSiteMonitor(EnableSiteMonitorRequest request) {
            return await new EnableSiteMonitorExecutor().Client(this).Execute<EnableSiteMonitorResponse, EnableSiteMonitorResult, EnableSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  修改可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public UpdateProbeTaskResponse UpdateProbeTask(UpdateProbeTaskRequest request) {
            return  new UpdateProbeTaskExecutor().Client(this).Execute<UpdateProbeTaskResponse, UpdateProbeTaskResult, UpdateProbeTaskRequest>(request);
        }
#else
        /// <summary>
        ///  修改可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<UpdateProbeTaskResponse> UpdateProbeTask(UpdateProbeTaskRequest request) {
            return await new UpdateProbeTaskExecutor().Client(this).Execute<UpdateProbeTaskResponse, UpdateProbeTaskResult, UpdateProbeTaskRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询可用性监控任务的指定探测源的异常探测历史
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeProbeHistoryResponse DescribeProbeHistory(DescribeProbeHistoryRequest request) {
            return  new DescribeProbeHistoryExecutor().Client(this).Execute<DescribeProbeHistoryResponse, DescribeProbeHistoryResult, DescribeProbeHistoryRequest>(request);
        }
#else
        /// <summary>
        ///  查询可用性监控任务的指定探测源的异常探测历史
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeProbeHistoryResponse> DescribeProbeHistory(DescribeProbeHistoryRequest request) {
            return await new DescribeProbeHistoryExecutor().Client(this).Execute<DescribeProbeHistoryResponse, DescribeProbeHistoryResult, DescribeProbeHistoryRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  删除可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DeleteProbeTaskResponse DeleteProbeTask(DeleteProbeTaskRequest request) {
            return  new DeleteProbeTaskExecutor().Client(this).Execute<DeleteProbeTaskResponse, DeleteProbeTaskResult, DeleteProbeTaskRequest>(request);
        }
#else
        /// <summary>
        ///  删除可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DeleteProbeTaskResponse> DeleteProbeTask(DeleteProbeTaskRequest request) {
            return await new DeleteProbeTaskExecutor().Client(this).Execute<DeleteProbeTaskResponse, DeleteProbeTaskResult, DeleteProbeTaskRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  删除站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DeleteSiteMonitorResponse DeleteSiteMonitor(DeleteSiteMonitorRequest request) {
            return  new DeleteSiteMonitorExecutor().Client(this).Execute<DeleteSiteMonitorResponse, DeleteSiteMonitorResult, DeleteSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  删除站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DeleteSiteMonitorResponse> DeleteSiteMonitor(DeleteSiteMonitorRequest request) {
            return await new DeleteSiteMonitorExecutor().Client(this).Execute<DeleteSiteMonitorResponse, DeleteSiteMonitorResult, DeleteSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取站点监控探针列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetSiteMonitorSourceResponse GetSiteMonitorSource(GetSiteMonitorSourceRequest request) {
            return  new GetSiteMonitorSourceExecutor().Client(this).Execute<GetSiteMonitorSourceResponse, GetSiteMonitorSourceResult, GetSiteMonitorSourceRequest>(request);
        }
#else
        /// <summary>
        ///  获取站点监控探针列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetSiteMonitorSourceResponse> GetSiteMonitorSource(GetSiteMonitorSourceRequest request) {
            return await new GetSiteMonitorSourceExecutor().Client(this).Execute<GetSiteMonitorSourceResponse, GetSiteMonitorSourceResult, GetSiteMonitorSourceRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询可用性监控任务信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeProbeTaskResponse DescribeProbeTask(DescribeProbeTaskRequest request) {
            return  new DescribeProbeTaskExecutor().Client(this).Execute<DescribeProbeTaskResponse, DescribeProbeTaskResult, DescribeProbeTaskRequest>(request);
        }
#else
        /// <summary>
        ///  查询可用性监控任务信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeProbeTaskResponse> DescribeProbeTask(DescribeProbeTaskRequest request) {
            return await new DescribeProbeTaskExecutor().Client(this).Execute<DescribeProbeTaskResponse, DescribeProbeTaskResult, DescribeProbeTaskRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询可用性监控agent状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeAgentStatusResponse DescribeAgentStatus(DescribeAgentStatusRequest request) {
            return  new DescribeAgentStatusExecutor().Client(this).Execute<DescribeAgentStatusResponse, DescribeAgentStatusResult, DescribeAgentStatusRequest>(request);
        }
#else
        /// <summary>
        ///  查询可用性监控agent状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeAgentStatusResponse> DescribeAgentStatus(DescribeAgentStatusRequest request) {
            return await new DescribeAgentStatusExecutor().Client(this).Execute<DescribeAgentStatusResponse, DescribeAgentStatusResult, DescribeAgentStatusRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateSiteMonitorResponse CreateSiteMonitor(CreateSiteMonitorRequest request) {
            return  new CreateSiteMonitorExecutor().Client(this).Execute<CreateSiteMonitorResponse, CreateSiteMonitorResult, CreateSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  创建站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateSiteMonitorResponse> CreateSiteMonitor(CreateSiteMonitorRequest request) {
            return await new CreateSiteMonitorExecutor().Client(this).Execute<CreateSiteMonitorResponse, CreateSiteMonitorResult, CreateSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询可用性监控任务的探测源列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DiscribeProbesResponse DiscribeProbes(DiscribeProbesRequest request) {
            return  new DiscribeProbesExecutor().Client(this).Execute<DiscribeProbesResponse, DiscribeProbesResult, DiscribeProbesRequest>(request);
        }
#else
        /// <summary>
        ///  查询可用性监控任务的探测源列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DiscribeProbesResponse> DiscribeProbes(DiscribeProbesRequest request) {
            return await new DiscribeProbesExecutor().Client(this).Execute<DiscribeProbesResponse, DiscribeProbesResult, DiscribeProbesRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查看可用性监控任务的监控数据
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeMetricDataAmResponse DescribeMetricDataAm(DescribeMetricDataAmRequest request) {
            return  new DescribeMetricDataAmExecutor().Client(this).Execute<DescribeMetricDataAmResponse, DescribeMetricDataAmResult, DescribeMetricDataAmRequest>(request);
        }
#else
        /// <summary>
        ///  查看可用性监控任务的监控数据
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeMetricDataAmResponse> DescribeMetricDataAm(DescribeMetricDataAmRequest request) {
            return await new DescribeMetricDataAmExecutor().Client(this).Execute<DescribeMetricDataAmResponse, DescribeMetricDataAmResult, DescribeMetricDataAmRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取站点监控任务信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetSiteMonitorResponse GetSiteMonitor(GetSiteMonitorRequest request) {
            return  new GetSiteMonitorExecutor().Client(this).Execute<GetSiteMonitorResponse, GetSiteMonitorResult, GetSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  获取站点监控任务信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetSiteMonitorResponse> GetSiteMonitor(GetSiteMonitorRequest request) {
            return await new GetSiteMonitorExecutor().Client(this).Execute<GetSiteMonitorResponse, GetSiteMonitorResult, GetSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启用、禁用可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ProbeTaskEnableResponse ProbeTaskEnable(ProbeTaskEnableRequest request) {
            return  new ProbeTaskEnableExecutor().Client(this).Execute<ProbeTaskEnableResponse, ProbeTaskEnableResult, ProbeTaskEnableRequest>(request);
        }
#else
        /// <summary>
        ///  启用、禁用可用性监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ProbeTaskEnableResponse> ProbeTaskEnable(ProbeTaskEnableRequest request) {
            return await new ProbeTaskEnableExecutor().Client(this).Execute<ProbeTaskEnableResponse, ProbeTaskEnableResult, ProbeTaskEnableRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  修改站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public UpdateSiteMonitorResponse UpdateSiteMonitor(UpdateSiteMonitorRequest request) {
            return  new UpdateSiteMonitorExecutor().Client(this).Execute<UpdateSiteMonitorResponse, UpdateSiteMonitorResult, UpdateSiteMonitorRequest>(request);
        }
#else
        /// <summary>
        ///  修改站点监控任务
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<UpdateSiteMonitorResponse> UpdateSiteMonitor(UpdateSiteMonitorRequest request) {
            return await new UpdateSiteMonitorExecutor().Client(this).Execute<UpdateSiteMonitorResponse, UpdateSiteMonitorResult, UpdateSiteMonitorRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取站点监控数据
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetSiteMonitorDataPointsResponse GetSiteMonitorDataPoints(GetSiteMonitorDataPointsRequest request) {
            return  new GetSiteMonitorDataPointsExecutor().Client(this).Execute<GetSiteMonitorDataPointsResponse, GetSiteMonitorDataPointsResult, GetSiteMonitorDataPointsRequest>(request);
        }
#else
        /// <summary>
        ///  获取站点监控数据
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetSiteMonitorDataPointsResponse> GetSiteMonitorDataPoints(GetSiteMonitorDataPointsRequest request) {
            return await new GetSiteMonitorDataPointsExecutor().Client(this).Execute<GetSiteMonitorDataPointsResponse, GetSiteMonitorDataPointsResult, GetSiteMonitorDataPointsRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询可用性监控任务列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeProbeTasksResponse DescribeProbeTasks(DescribeProbeTasksRequest request) {
            return  new DescribeProbeTasksExecutor().Client(this).Execute<DescribeProbeTasksResponse, DescribeProbeTasksResult, DescribeProbeTasksRequest>(request);
        }
#else
        /// <summary>
        ///  查询可用性监控任务列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeProbeTasksResponse> DescribeProbeTasks(DescribeProbeTasksRequest request) {
            return await new DescribeProbeTasksExecutor().Client(this).Execute<DescribeProbeTasksResponse, DescribeProbeTasksResult, DescribeProbeTasksRequest>(request).ConfigureAwait(false);
        }
#endif

            /// <summary>
            ///  默认DetectionClient 构造器 接口
            ///</summary>
            public interface Builder
            {

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>detectionClient 构造器</returns>
                Builder CredentialsProvider(CredentialsProvider provider);

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>detectionClient 构造器</returns>
                Builder Environment(Core.Client.SDKEnvironment environment);

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>detectionClient 构造器</returns>
                Builder HttpRequestConfig(HttpRequestConfig config);

                /// <summary>
                ///  构造DetectionClient 对象
                ///</summary>
                DetectionClient Build();
            }

            /// <summary>
            ///  默认DetectionClient 构造器
            ///</summary>
            public class DefaultBuilder : Builder
            {
                /// <summary>
                ///  DetectionClient service client
                /// </summary>
                private  DetectionClient detectionClient;

                /// <summary>
                ///  默认DetectionClient 构造器构造对象
                ///</summary>
                public DefaultBuilder()
                {
                    detectionClient = new DetectionClient();
                }

                /// <summary>
                ///  构造DetectionClient 对象
                ///</summary>
                public DetectionClient Build()
                {
                    if (detectionClient.CredentialsProvider == null)
                    {
                        //if credentialsProvider not set, try load jdcloud global default  credentials provider
                        detectionClient.credentialsProvider = JdCloud.DefaultInstance.GetCredentialsProvider();
                        if (detectionClient.credentialsProvider == null)
                        {
                            throw new ArgumentNullException("DetectionClient build error: jdcloud credentials provider not set");
                        }
                    }
                    if (detectionClient.HttpRequestConfig == null)
                    {
                        detectionClient.httpRequestConfig = JdCloud.DefaultInstance.GetHttpRequestConfig();
                        if (detectionClient.httpRequestConfig == null)
                        {
                        throw new ArgumentNullException("DetectionClient build error: http request config not set");
                        }
                    }
                    return detectionClient;
                }

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>detectionClient 构造器</returns>
                public Builder CredentialsProvider(CredentialsProvider provider)
                {
                    detectionClient.credentialsProvider = provider;
                    return this;
                }

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>detectionClient 构造器</returns>
                public Builder Environment(SDKEnvironment environment)
                {
                    detectionClient.environment = environment;
                    return this;
                }

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>detectionClient 构造器</returns>
                public Builder HttpRequestConfig(HttpRequestConfig config)
                {
                    detectionClient.httpRequestConfig = config;
                    return this;
                }
            }
    }
}
